<?php
namespace app\common\model;
use think\Model;

class FinanceRecord  extends Base
{
  //添加财务记录方法
  public function addRecord($uid,$amount,$remark,$bankname="余额"){

            $map['uid'] = $uid;
            $user = model('user')->infoData($map);
            $dataRecord['uid']       = $uid;
            $dataRecord['username']  = $user['username'];
            $dataRecord['amount']    = $amount; //金额
            $dataRecord['remark']    = $remark; //备注
            $dataRecord['bankname']  = $bankname; //银行类型
            $dataRecord['balance']   = $user['money']; //余额
            $dataRecord['create_time']  = time();
            model('financeRecord')->addData($dataRecord); 
  }
//添加信息
   public function add($data){
       if(empty($data) || !is_array($data) ){ 
          return false;
        }
        return $this->create($data);
  }
   public function del($id){
   	if(!$id){  return true; }
   	if(is_array($id)){
   	  $id = implode(',',$id);
   	}
   	 $where['id'] = $id;
     if($this->where($where)->delete()){
       return true;
     }else{
       return false;
     }
   }


}
